home *** CD-ROM | disk | FTP | other *** search
/ Wildcat Files 2 / The Wildcat Files 2 (Arsenal Computer).ISO / wildcat / wc26rec.typ < prev    next >
Text File  |  1992-11-02  |  42KB  |  870 lines

  1. (***************************************************************************
  2.  
  3. WC26REC.TYP  - File and Record locking information for WILDCAT! v2.6
  4.                Note, this structure is the same for all 3 versions,
  5.                ('S', 'N', 'P').
  6.  
  7. REFERENCE    - WILDCAT! supports true record locking.  This means a utility,
  8.                written correctly, maybe designed to run while other WILDCAT!
  9.                nodes are up and accepting calls.  This may not be a
  10.                requirement, if your utility is simply going to create a
  11.                report.  The utility would just have to make certain that the
  12.                FileMode is opened in Share ReadOnly (40h).
  13.  
  14.                If you want to write full blown WILDCAT! utilities, then
  15.                you'll need to purchase the same BTree File Management
  16.                package used by us.  The Package is called BTree Filer,
  17.                and may be purchased directly from:
  18.  
  19.                Turbo Power Software
  20.                P.O. Box 49009
  21.                Colorado Springs, CO
  22.                Voice  (719) 260-6641
  23.                Orders (800) 333-4160
  24.                Fax    (719) 260-4160
  25.  
  26.                CompuServe 72457,2131
  27.  
  28.                Please be sure to mention you're a WILDCAT! Sysop when placing
  29.                your order.
  30.  
  31. BACKGROUND   - WILDCAT! has undergone a MAJOR REVISION with version 2.0.
  32.                Like every version since version 1.0, it is faster and requires
  33.                less memory then it predecessor.  These improvements do come
  34.                at a cost however, the cost is any 3rd party utility written
  35.                for WILDCAT! which reads the DATABASE files, will have to be
  36.                upgraded.  In most cases, all of the Live programs written for
  37.                WILDCAT! v1.1x should NOT require any modification.
  38.  
  39. =============================================================================
  40. RECORD & TYPE
  41. DECLARATION -
  42. =============================================================================
  43.  
  44.   (******************************************************************
  45.  
  46.   Global record structure for WILDCAT! version 2.x.
  47.   Copyright 1989,94  Mustang Software Inc.  All rights reserved.
  48.  
  49.   Mustang Software, Inc.              Voice 805/873-2500
  50.   6200 Lake Ming Road                 BBS   805/873-2400
  51.   Bakersfield, CA  93306              CIS   GO PCVENA, SS9
  52.  
  53.   ******************************************************************)
  54.  
  55.  
  56. interface
  57.  
  58. uses
  59.  
  60.   TpDate, Filer;
  61.  
  62. (* Note, Unit Filer is from Turbo Powers BTree Filer Product, Unit
  63.   TpDate is from Turbo Powers' Turbo Professional Product, which
  64.   is not required to create 3rd party utilities, however will assist
  65.   you if you're a Turbo Pascal Programmer.
  66.  
  67.   In TPDate, we would find the following record formats:
  68.  
  69.   Time = LongInt; { Numbers of Seconds since midnight }
  70.   Date = LongInt; { Number of days since 1/1/1600 }
  71.  
  72.   DateTimeRec = Record  { Record which holds a date/time value }
  73.                   D : Date;
  74.                   T : Time;
  75.                 end;
  76.  
  77.   DateString = String[20]; { ie date spelled out in any format }
  78.  
  79.   ***********************************************************************)
  80.  
  81.  
  82. const
  83.   MaxSecLevels   = 50;
  84.  
  85.   {------------------ Type Declarations ----------------------}
  86.  
  87. type
  88.   DataBaseProtectionType = (NoProtection, MarkMode, SaveMode);
  89.   BBSFileType    = (MasterFile, NodeFile, RangeFile, DoorFile);
  90.   Password_Type  = (NotReq, YesReq, Protect);
  91.   Mono_Type      = (M_Color, M_Mono, M_Auto);
  92.   DetermineBaudType = (ByResult, ByCR);
  93.   Closed_Type    = (Open, Closed, ClosedComment, ClosedQuestionnaire);
  94.   AnswerPhoneType = (ByRing, ByAutoAnswer);
  95.   Security_Array = array[1..MaxSecLevels] of String[26];
  96.   Transfer_Type  = (All, Xmodem, XmodemCRC, Ymodem, YmodemG, Xmodem1K,
  97.                     Xmodem1KG, ASCii, ExtBatch, Ext1, Ext2, Ext3, Ext4, Ext5, Ext6, Ext7, Ext8,
  98.                     Ext9, Ext10);
  99.   More_Prompt_Type = (Erase_Prompt, Next_Line);
  100.   Expertise_Level = (Novice, Regular, Expert);
  101.   Logoff_Type    = (Normal, Dropped_Carrier, TimeLimit_Exceeded, By_Sysop, No_Activity);
  102.   NodeStatusType = (Up, Down, LoggedIn, Crash, EventProcessing, Event60, NetEcho);
  103.  
  104.   ChatStatusType = (Available, Request, UnAvailable, Paged, Group);
  105.  
  106.   UserStatusType = (None, FileTransfer, EnteringMsg, InLive, InDOS, PChat, GChat);
  107.   TBaud          = (B300, B1200, B2400, B4800, B9600, B19200, B38400, BLocal);
  108.   ResultCodeBaud = (R300, R1200, R1200V22, R2400, R9600, R19200);
  109.  
  110.   DoorInfo_Type  = record                                          { DOOR.DAT }
  111.                      Security       : Word;                     { Min Sec for }
  112.                      MultiUser,                             { MultiUser Door? }
  113.                      InUse          : Boolean;                 { is it inuse? }
  114.                    end;                                             { 4 Bytes }
  115.  
  116.   MasterInfo_Type = record                                       { MASTER.DAT }
  117.                       Version_Id     : String[5];            { Version Number }
  118.                       ActiveNodes    : array[1..250] of Boolean; { List of Active Nodes }
  119.                       TotalCalls     : LongInt;       { Total Number of Calls }
  120.                     end;                                          { 260 Bytes }
  121.  
  122.  
  123.   MessageInfo_Type = record                                     { MESSAGE.DAT }
  124.                        ActiveMessages,            { Number of active messages }
  125.                        MsgLow,                            { Low Message Range }
  126.                        MsgHigh        : LongInt;         { High Message Range }
  127.                      end;                                          { 12 Bytes }
  128.  
  129.   NodeInfo_Type  = record                                      { NODEINFO.DAT }
  130.                      NodeID         : Byte;                     { Node Number }
  131.                      NodeStatus     : NodeStatusType;        { Up/Down, Etc.. }
  132.                      ChatStatus     : ChatStatusType;      { Available, etc.. }
  133.                      UserStatus     : UserStatusType; { Entering a Message, etc.. }
  134.                      CallersName    : String[37];                      { name }
  135.                      From           : String[30];                  { city, st }
  136.                      PrevCaller     : String[60];       { Last caller on node }
  137.                      BaudRate       : TBaud;                      { baud rate }
  138.                      PrevLogOff,                         { L/Callers time off }
  139.                      TimeOff        : DateTimeRec; { Time limit expired date/time }
  140.                      RequestNode,                      { Node requesting chat }
  141.                      SecurityLevel  : Integer;       { callers security level }
  142.                      PagedDisplayed,     { have we told them about their page }
  143.                      LptrFlag,                             { node Lptr toggle }
  144.                      PageFlag,                             { node page toggle }
  145.                      BellFlag,                              {node bell toggle }
  146.                      KybdFlag,                             { node Kybd toggle }
  147.                      LocalNextFlag,                  { node Local next toggle }
  148.                      ScreenWriteFlag,              { node screen write toggle }
  149.                      EventNextFlag,                  { node event next toggle }
  150.                      BringDown,                      { node bring down toggle }
  151.                      KillCaller,                 { node log caller off toggle }
  152.                      PagingSysop    : Boolean;       { node paging sysop flag }
  153.                      Quote_Index    : Word;        { Quote file index pointer }
  154.                      NumberOfCalls  : LongInt; { totals calls received by node }
  155.                    end;                                           { 166 bytes }
  156.  
  157.   MsgHeaderOnly_Type = record                        { used in vrec unit only }
  158.                          Status         : LongInt;            { B-Tree Status }
  159.                          MessageNumber  : Word;              { Message Number }
  160.                          DateTime       : DateTimeRec;  { Message Date & Time }
  161.                          From           : String[37]; { Who wrote the message }
  162.                          TO_            : String[37]; { Who is the message to }
  163.                          Subject        : String[37];               { Subject }
  164.                          Conference     : Char; { Conference it is assigned to }
  165.                          TotalLines     : Byte;       { Total number of lines }
  166.                          Referenced,               { This message has threads }
  167.                          Private,                    { Is the message private }
  168.                          Forwarded,         { Has this message been forwarded }
  169.                          Receipt,                  { Return Receipt Requested }
  170.                          CarbonCopy,                  { Is this a Carbon Copy }
  171.                          Received       : Boolean; { Has the message been Received}
  172.                        end;
  173.  
  174.   Message_Type   = record                                       { MSGFILE.DAT }
  175.                      Status         : LongInt;                { B-Tree Status }
  176.                      MessageNumber  : Word;                  { Message Number }
  177.                      DateTime       : DateTimeRec;      { Message Date & Time }
  178.                      From           : String[37];     { Who wrote the message }
  179.                      TO_            : String[37];     { Who is the message to }
  180.                      Subject        : String[37];                   { Subject }
  181.                      Conference     : Char;    { Conference it is assigned to }
  182.                      TotalLines     : Byte;           { Total number of lines }
  183.                      Referenced,                   { This message has threads }
  184.                      Private,                        { Is the message private }
  185.                      Forwarded,             { Has this message been forwarded }
  186.                      Receipt,                      { Return Receipt Requested }
  187.                      CarbonCopy,                      { Is this a Carbon Copy }
  188.                      Received       : Boolean; { Has the message been Received}
  189.                      Contents       : array[1..150] of String[80];
  190.                    end;                        { <vrec> max size 12,292 bytes }
  191.  
  192.  
  193.   File_Record_Type = record                                    { FILESPEC.DAT }
  194.                        Status         : LongInt;              { B-Tree Status }
  195.                        FileName       : String[12];        { Name of the file }
  196.                        Password       : String[14];        { 12 Byte password }
  197.                        FileDate,                           { Date of the file }
  198.                        LastAccessed   : DateTimeRec;    { Date of last access }
  199.                        Desc           : array[1..2] of String[40]; { Description }
  200.                        UploadedBy     : String[37];         { Who uploaded by }
  201.                        Area           : Char;   { file Area it is assigned to }
  202.                        NumOfAccess,                     { Number of downloads }
  203.                        Size           : LongInt;           { Size of the File }
  204.                        PasswordReq    : Password_Type; { Is a password required }
  205.                      end;                                    { Size 178 Bytes }
  206.  
  207.   Event_Type     = record                                         { SCHED.BBS }
  208.                      Schedule       : Char;                    { Event Letter }
  209.                      StartTime      : String[5];                 { Start Time }
  210.                      LengthTime     : Integer;          { Length of the Event }
  211.                      Active         : Boolean;                 { Is it active }
  212.                      Day_Active     : Byte; {which days       0 = Mon, 1 = Tue... }
  213.                    end;
  214.  
  215.  
  216.   Menu_Record_Type =                                        { In CONFIGWC.BBS }
  217.     array[1..4] of record
  218.       Sec_Level      : array[1..19] of Word;                   { Req Security }
  219.       Desc           : array[1..19] of String[35];              { Description }
  220.       Call_Ltr, ID   : array[1..19] of Char;           { Internal Call Letter }
  221.       Order          : array[1..19] of Byte;                 { Sequence Order }
  222.     end;
  223.  
  224.  
  225.   Config_Record  = record                                        {CONFIGWC.BBS}
  226.                      MWVersion      : String[5];           { makewild version }
  227.                      ModemReSet     : String[10];        { Modem Reset String }
  228.                      SysFirst,                           { Sysop's First Name }
  229.                      Syslast        : String[15];         { Sysop's Last Name }
  230.                      OffHook,                         { Modem Off Hook String }
  231.                      OnHook         : String[20];      { Modem On Hook String }
  232.                      FirstCall      : String[25];        { Date of First Call }
  233.                      NewUserConfs   : String[26];    { New User Default Conf. }
  234.                      BBSName        : String[30];           { Name of the BBS }
  235.                      StartUp1,                             { Startup String 1 }
  236.                      StartUp2,                             { Startup String 2 }
  237.                      StartUp3,                             { Startup String 3 }
  238.                      Modminit       : String[40];             { Reinit String }
  239.                      BulletinPath,                            { Bulletin Path }
  240.                      ProtocolPath,             { External Protocol/Batch Path }
  241.                      MenuPath,                              { Menu File Paths }
  242.                      HelpPath,                              { Help File Paths }
  243.                      displaypath,                        { Display File Paths }
  244.                      MsgDataBasePath,                          { Message path }
  245.                      FileDataBasePath,                            { File path }
  246.                      UserDataBasePath,                    { USERINFO.DAT path }
  247.                      MasterPath,                                { Master Path }
  248.                      QuesPath,                           { Questionnaire path }
  249.                      DoorPath       : String[67];                 { Door path }
  250.                      AnswerPhone    : AnswerPhoneType;  { Way to answer phone }
  251.                      DetermineBaud  : DetermineBaudType; { how to determine baud rate }
  252.                      MonitorType    : Mono_Type;               { Monitor type }
  253.                      CloseOption    : Closed_Type;     { Closed Board Options }
  254.                      Menu           : Menu_Record_Type;        { menu details }
  255.                      Network        : NetSupportType;       { type of network }
  256.                      DataBaseOpenMode : DataBaseProtectionType; { open mode type }
  257.                      FileConf,                      { File Conf. Descriptions }
  258.                      FilePath,                                   { File Paths }
  259.                      MessageConf    : array[1..26] of String[30];  { Msg Conf }
  260.                      SecMaxDK,                           { Max Downld K-bytes }
  261.                      SecMaxDL,                                { Max downloads }
  262.                      SecLevel,                            { Sec level defines }
  263.                      SecLevelTime   : array[1..MaxSecLevels] of Word; { Time Limits }
  264.                      SecLevelAnsi   : array[1..MaxSecLevels] of Char; { Ansi Menus }
  265.                      SecLevelRatio  : array[1..MaxSecLevels] of Byte; { up/dn ratio }
  266.                      SecLevelMsg,                    { Message Access Letters }
  267.                      SecLevelFile,              { DL File Area Access Letters }
  268.                      SecLevelUpload : Security_Array;           {UP File area }
  269.                      ExtLtr         : array[1..10] of Char;       {Ext P/Calls}
  270.                      ExtUpBatch,                         { Upload batch Names }
  271.                      ExtDnBatch,                       { Download Batch Names }
  272.                      ExtName        : array[1..10] of String[12]; { Ext Names }
  273.                      ExtBatchDriven : array[1..10] of Boolean;        { Batch }
  274.                      ResultCodeMNP,                        { MNP result codes }
  275.                      ResultCode     : array[R300..R19200] of String[02]; { Normal result codes }
  276.                      ExtraMemForPageStack,                 { Extra Page Stack }
  277.                      ExtraMemForOverlay,                 { Extra Overlay Buff }
  278.                      CommIrq,                                      { IRQ used }
  279.                      CommPort,                              { Comm Port number}
  280.                      NodeID,                                 { Node Id number }
  281.                      ForgroundColor,                                  { Color }
  282.                      SecTries,             { number of password tries allowed }
  283.                      CWait          : Byte;                {Carrier Wait time }
  284.                      TotalLiveProg,                     { Total live programs }
  285.                      MinNodeSecurity,       { minimum security to access node }
  286.                      Commbase,                       { Comm port base address }
  287.                      Delay1,                              { Modem Delay Times }
  288.                      Delay2,
  289.                      Delay3,
  290.                      BaudInit,                     { Baud Rate Initialization }
  291.                      NewUserSec,                   { New Users Security level }
  292.                      Ftimelimit,                      { First Call time limit }
  293.                      LinesPage,                      { Lines per page default }
  294.                      LogonTimeLimit,             { Max time allowed per logon }
  295.                      CheckBDay,                                { Verify BDate }
  296.                      CheckPhone_No,                            { verify phone }
  297.                      OverwriteUploads,               { Upload overwrite priv. }
  298.                      UploadComp,                               { Compensation }
  299.                      SysopMailSec,                          { Read Sysop Mail }
  300.                      TotalMsgConf,                        { Total Conferences }
  301.                      TotalFileConf,                  { total file conferences }
  302.                      NumOfSecLevels,              { number of security levels }
  303.                      TotalNumOfBulls,          { number of bulletins to check }
  304.                      PreDelay,                          { Delay before Prelog }
  305.                      MasterSysop,                      { Sec for Master sysop }
  306.                      TotalExtProtocols,        { number of external protocols }
  307.                      TotalQues,                        { total questionnaires }
  308.                      MinSecForExternals : Word;                    { Integers }
  309.                      PhoneReq,                     { Newusers - ask for phone }
  310.                      BDayReq,                   { Newusers - ask for birthday }
  311.                      CTypeReq,             { Newusers - ask for computer type }
  312.                      QuesReq,             { Newusers - force to questionnaire }
  313.                      SysopDropToDos, { Sysops are allowed to drop to dos /remote }
  314.                      ScreenMsgs,                        { screen all messages }
  315.                      LeavePrivate,               { may leave private messages }
  316.                      BulletsOptional,                { bulletins are optional }
  317.                      DisplayQuoteDay,             { look for quote of the day }
  318.                      ColorAnsi,       { are color scrrens going to be offered }
  319.                      DropOnExit,                           { Offhook when f10 }
  320.                      FixedRate,                                    { Lock DTE }
  321.                      ShowSec,                       { show apssword on screen }
  322.                      ShowPWFiles,          { Display Password protected files }
  323.                      UseClearScreens,  { Use clear screens in dynamic screens }
  324.                      CTSRTSFlowControl,         { Modem hardware flow control }
  325.                      Error60AfterCall,     { Drop to errorlevel 60 after call }
  326.                      UseCharFilter,                       { filter line noise }
  327.                      FreeFormPhone,                    { format phone numbers }
  328.                      UseExecSwap,                    { shell exec to ems/disk }
  329.                      UseEMSForOverlay,           { use ems for overlay buffer }
  330.                      UseEMSForExecSwap,               { use ems for exec swap }
  331.                      OverwriteChatFiles,                   { reuse chat files }
  332.                      PromptForAnsi,                 { Newuser - ask for color }
  333.                      UseDynamicMenus,                    { use built in menus }
  334.                      LogOffIfNotVerified,  { log-off for incorrect bday/phone }
  335.                      LockOutForSecError,        { lock out for password error }
  336.                      PromptToKillRecMsg,         { beep to kill received mail }
  337.                      ReplaceOkByOriginal,            { overwrite ok by author }
  338.                      ShutOffDownloadsIfOverRatio : Boolean;     { no more dls }
  339.                      PageStart,                 { Sysop Pageing Hours <Start> }
  340.                      PageEnd,                     { Sysop Pageing Hours <End> }
  341.                      StartTime300Baud,                  { 300 baud start time }
  342.                      StopTime300Baud : Time;              { 300 baud end time }
  343.                      DateFormat,                         { date format to use }
  344.                      TimeFormat     : DateString;        { time format to use }
  345.                    end;
  346.  
  347.  
  348.  
  349.   User_Record_Type = record
  350.                        Status         : LongInt;               { Btree Status }
  351.                        UserName       : String[37];              { Users name }
  352.                        CallingFrom    : String[30];                { location }
  353.                        Password       : String[14];                { Password }
  354.                        PhoneNumber    : String[12];       { User phone number }
  355.                        ComputerType   : String[15];     { Users Computer Type }
  356.                        ConfJoined     : String[26];            { Open Folders }
  357.                        MorePrompt     : More_Prompt_Type;      { Erase -MORE- }
  358.                        Xpert          : Expertise_Level;        { Xpert level }
  359.                        TransferMethod : Transfer_Type;             { Protocol }
  360.                        HighMsg        : array['A'..'Z'] of Word; { Last read each folder }
  361.                        LinesPerPage   : Byte;               { Lines Per Page  }
  362.                        LastNew,                       { Last New Files Search }
  363.                        TimeDate       : DateTimeRec;       { Last time called }
  364.                        MemoDate,                           { Extra Date Field }
  365.                        UserSince,                         { Date First Called }
  366.                        BirthDate      : Date;               { Users Birth Day }
  367.                        SecurityLevel,                        { Security level }
  368.                        Uploads,                            { Number of ULoads }
  369.                        Downloads,                          { Number of DLoads }
  370.                        TimesOn,                             { Number times on }
  371.                        TimeLeft       : Word;               { Time left today }
  372.                        DailyDL,       { temp counter for daily download count }
  373.                        DailyDK,              { temp counter for daily K-bytes }
  374.                        TotalUK,                            { Total K uploaded }
  375.                        TotalDK        : LongInt;           { Total K downlded }
  376.                        ChatPage,                                 { Ok to Page }
  377.                        HotKey,                                 { Use Hot Keys }
  378.                        LockedOut,                             { allowed user? }
  379.                        ColorMenus     : Boolean;           { type of graphics }
  380.                      end;
  381.  
  382. implementation
  383.  
  384. end.
  385.  
  386. ====================================================================
  387. BTREE KEY
  388. DECLARATION -
  389. ====================================================================
  390.  
  391. Const
  392.   { UsersFile Index }
  393.   RevNameKey     = 1;
  394.   USecKey        = 2;
  395.  
  396.   {DatF Index}
  397.   NameKey        = 1;
  398.   DateKey        = 2;
  399.   AreaKey        = 3;
  400.   UploaderKey    = 4;
  401.  
  402.   {MessageFile Index}
  403.   MsgNumKey      = 1;
  404.   MsgToKey       = 2;
  405.   MsgFromKey     = 3;
  406.   MsgAreaKey     = 4;
  407.   MsgSubjKey     = 5;
  408.  
  409.  
  410. In BTree Filer  { These MUST BE THE SAME!!! }
  411.  
  412.   MaxNrOfKeys = 5;
  413.   MaxKeyLen = 30;
  414.   MaxNrOfWorkStations = 250;
  415.   PageSize = 62;
  416.   MaxHeight = 8;
  417.   DatExtension = 'DAT';
  418.   IxExtension = 'IX';
  419.   DiaExtension = 'DIA';
  420.   SavExtension = 'SAV';
  421.   MsgExtension = 'MSG';
  422.   LockedListBlockSize = 16;
  423.   SearchForSequentialDefault : Boolean = True;
  424.  
  425.  
  426. NOTE: The WordToKey, Pack6bitKeyUC routines are all included with
  427. the BTree Filer from Turbo Power.  They're in there NumKeys Unit.
  428.  
  429.   function TotalKeys(Database : Char) : Byte;
  430.     { Returns the number of keys for each database }
  431.   begin
  432.     case Database of
  433.       'M' : TotalKeys := 5;                                        { Messages }
  434.       'F' : TotalKeys := 4;                                           { Files }
  435.       'U' : TotalKeys := 2;                                           { Users }
  436.     else noteerror('TotalKeys Error: '+Database);
  437.     end;                                                                { Case}
  438.   end;
  439.  
  440.   { -----------------  Messaage Btree Procedures ------------------}
  441.  
  442.  
  443.   function MsgSize(TotalLines : Word) : Word;
  444.     { computes the record size based on number of lines }
  445.   begin
  446.     MsgSize := SizeOf(MsgHeaderOnly_Type)+(TotalLines*81);
  447.   end;
  448.  
  449.   function BuildMsgAreaKey(Area : Char; Num : Word) : Str03;
  450.     { Build the Msg Area key, used for folder reading }
  451.   begin
  452.     BuildMsgAreaKey := Area+WordToKey(Num);
  453.   end;
  454.  
  455.   function BuildTFKey(Name : Str15; msgNum : Word) : Str14;
  456.     { Use to create a Message To/From Key }
  457.   begin
  458.     BuildTFKey := Pack6BitKeyUC(Name,12)+WordToKey(msgNum);
  459.   end;
  460.  
  461.   function BuildMsgNumKey(msgNum : Word; Area : Char) : Str03;
  462.     { Build the Msg Number key, used for sequencial reading }
  463.   begin
  464.     BuildMsgNumKey := WordToKey(msgNum)+Area;
  465.   end;
  466.  
  467.   {$F+} function BuildMsgKey(var Rec; KeyNum : Byte) : Str30; {$F-}
  468.     { Shell for Build Msg Keys }
  469.   var
  470.     MsgRec         : Message_Type absolute Rec;
  471.   begin
  472.     with MsgRec do
  473.       case KeyNum of
  474.         MsgNumKey : BuildMsgKey := BuildMsgNumKey(MessageNumber, Conference);
  475.         MsgToKey : BuildMsgKey := BuildTFKey(switchlast(TO_), MessageNumber);
  476.         MsgFromKey : BuildMsgKey := BuildTFKey(SwitchLast(From), MessageNumber);
  477.         MsgAreaKey : BuildMsgKey := BuildMsgAreaKey(Conference, MessageNumber);
  478.         MsgSubjKey : BuildMsgKey := Pack6BitKeyUC(Subject, 28)+WordToKey(MessageNumber);
  479.       end;                                                             { Case }
  480.   end;
  481.  
  482.  
  483.   { ------------------------- File Btree Procedures -----------------------}
  484.  
  485.  
  486.   function BuildFileNameKey(Name : String) : Str09;
  487.     { used for the file listing }
  488.   begin
  489.     BuildFileNameKey := Pack6BitKeyUC(Name, 9);
  490.   end;
  491.  
  492.   function BuildFileDateKey(DD : DateTimeRec) : Str08;
  493.     { used for new files listing }
  494.   begin
  495.     BuildFileDateKey := LongToKey(DD.D)+LongToKey(DD.T);
  496.   end;
  497.  
  498.   function BuildFileAreaKey(Area           : Char;
  499.                             Name           : Str12) : Str10;
  500.     { used for list files, by areas }
  501.   begin
  502.     BuildFileAreaKey := Area+Pack6BitKeyUC(Name, 9);
  503.   end;
  504.  
  505.  
  506.   function BuildFileKey(var Rec; KeyNum : Byte) : Str30;
  507.     { shell around file key creation }
  508.   var
  509.     FileRec        : File_Record_Type absolute Rec;
  510.   begin
  511.     with FileRec do
  512.       case KeyNum of
  513.         NameKey : BuildFileKey := BuildFileNameKey(FileName);
  514.         DateKey : BuildFileKey := BuildFileDateKey(FileDate);
  515.         AreaKey : BuildFileKey := BuildFileAreaKey(Area, FileName);
  516.         UploaderKey : BuildFileKey := SwitchLastKey(UploadedBy, 23);
  517.       end;                                                               {Case}
  518.   end;
  519.  
  520.   { ------------------------- User BTree Procedures -----------------------}
  521.  
  522.   function SwitchLastKey(Name : Str80; Len : Byte) : Str23;
  523.     { Builds the user name key }
  524.   begin
  525.     SwitchLastKey := Pack6BitKeyUC(SwitchLast(Name), Len);
  526.   end;
  527.  
  528.   {$F+} function BuildUserKey(var Rec; KeyNum : Byte) : Str30; {$F-}
  529.     { Shell around the user database keys }
  530.   var
  531.     UserRec        : User_Record_Type absolute Rec;
  532.   begin
  533.     with UserRec do
  534.       case KeyNum of
  535.         RevNameKey : BuildUserKey := SwitchLastKey(UserName, 23);
  536.         USecKey : BuildUserKey := WordToKey(SecurityLevel)+(SwitchLastKey(UserName, 5));
  537.       end;                                                             { Case }
  538.   end;
  539.  
  540.  
  541.   { ----------------------- General BTree Routines --------------------}
  542.  
  543.  
  544.   function BuildKey(var Rec; Database : Char; KeyNum : Byte) : Str30;
  545.     { Shell to build all keys on the fly }
  546.   begin
  547.     case Upcase(Database) of
  548.       'M' : BuildKey := BuildMsgKey(Rec, KeyNum);
  549.       'F' : BuildKey := BuildFileKey(Rec, KeyNum);
  550.       'U' : BuildKey := BuildUserKey(Rec, KeyNum);
  551.     end;                                                               { Case }
  552.   end;
  553.  
  554.  
  555.   { ---------------------- Open/Initialize BTree Files ----------------------}
  556.  
  557.  
  558.   procedure Open_Users(initializing : Boolean);
  559.     { Users Data Base File }
  560.   var
  561.     FB_Color       : Byte;
  562.  
  563.     procedure Create_Users;
  564.     var
  565.       Keys           : IsamIndDescr;
  566.     begin
  567.       Keys[1].KeyL := 23;
  568.       Keys[1].AllowDupK := False;
  569.       Keys[2].KeyL := 7;
  570.       Keys[2].AllowDupK := True;
  571.       MakeNetFileBlock(UsersFile, Cfig.UserDataBasePath+'USERFILE', SizeOf(User), 2, Keys);
  572.       if not IsamOK then
  573.         case IsamError of
  574.           10320 : Log_Fatal_Error('Network Lock Failure Or Share Not Loaded, IsamError);
  575.         else
  576.           Log_Fatal_Error('ERROR CREATING "USERFILE"', IsamError);
  577.         end
  578.       else StatusLine('>> Created Users Data Base Files & Indexes <<');
  579.  
  580.     end;
  581.  
  582.   begin
  583.     if ColorScreen then FB_Color := 31
  584.     else FB_Color := 15;
  585.     if ExistFile(Cfig.UserDataBasePath+'USERFILE.DAT') then
  586.       begin
  587.         repeat
  588.           if Cfig.DataBaseOpenMode = SaveMode then
  589.           OpenSaveNetFileBlock(UsersFile, Cfig.UserDataBasePath+'USERFILE) else
  590.             OpenNetFileBlock(UsersFile, Cfig.UserDataBasePath+'USERFILE');
  591.         until LockOk;
  592.         if not IsamOK then
  593.           case IsamError of
  594.             10330 : Log_Fatal_Error('Network Lock Failure Or Share Not Loaded', IsamError);
  595.           else
  596.             Log_Fatal_Error('ERROR OPENNING "USERFILE"', IsamError);
  597.           end;
  598.       end
  599.     else Create_Users;
  600.     TotalUsers := UsedNetRecs(UsersFile);
  601.     if initializing then
  602.       begin
  603.         if Console_Flag then
  604.           WriteAT(AddCommas(UsedNetRecs(UsersFile), False), FB_Color, 26, 9);
  605.         CloseBtreeFile(UsersFile);
  606.       end;
  607.   end;
  608.  
  609.  
  610.   procedure Open_Files(initializing : Boolean);
  611.     { Files Data Base Files }
  612.   var
  613.     FB_Color       : Byte;
  614.  
  615.     procedure Create_Files;
  616.     var
  617.       Keys           : IsamIndDescr;
  618.     begin
  619.       Keys[1].KeyL := 9;
  620.       Keys[1].AllowDupK := False;
  621.       Keys[2].KeyL := 8;
  622.       Keys[2].AllowDupK := True;
  623.       Keys[3].KeyL := 10;
  624.       Keys[3].AllowDupK := False;
  625.       Keys[4].KeyL := 23;
  626.       Keys[4].AllowDupK := True;
  627.       MakeNetFileBlock(DatF, Cfig.FileDataBasePath+'FILESPEC', SizeOf(File_Record_Type), 4, Keys);
  628.       if not IsamOK then Log_Fatal_Error('ERROR CREATING "FILESPEC"', IsamError)
  629.       else StatusLine('>> Created File Menu Index Files <<');
  630.     end;
  631.  
  632.  
  633.   begin
  634.     if ColorScreen then FB_Color := 31
  635.     else FB_Color := 15;
  636.     if ExistFile(Cfig.FileDataBasePath+'FILESPEC.DAT') then
  637.       begin
  638.         repeat
  639.           if Cfig.DataBaseOpenMode = SaveMode then
  640.           OpenSaveNetFileBlock(DatF, Cfig.FileDataBasePath+'FILESPEC') else
  641.             OpenNetFileBlock(DatF, Cfig.FileDataBasePath+'FILESPEC');
  642.         until LockOk;
  643.         if not IsamOK then Log_Fatal_Error('ERROR OPENING "FILESPEC"', IsamError);
  644.       end
  645.     else Create_Files;
  646.     TotalFiles := UsedNetRecs(DatF);
  647.     if initializing then
  648.       begin
  649.         if Console_Flag then
  650.           WriteAT(AddCommas(UsedNetRecs(DatF), False), FB_Color, 26, 10);
  651.         CloseBtreeFile(DatF);
  652.       end;
  653.   end;
  654.  
  655.  
  656.   procedure Open_Messages(initializing : Boolean);
  657.     { Message Data Base Files }
  658.   var
  659.     RInfo          : MessageInfo_Type;
  660.     FB_Color       : Byte;
  661.  
  662.     procedure Create_Messages;
  663.     var
  664.       Keys           : IsamIndDescr;
  665.     begin
  666.       Keys[1].KeyL := 3;
  667.       Keys[1].AllowDupK := False;
  668.       Keys[2].KeyL := 14;
  669.       Keys[2].AllowDupK := False;
  670.       Keys[3].KeyL := 14;
  671.       Keys[3].AllowDupK := False;
  672.       Keys[4].KeyL := 3;
  673.       Keys[4].AllowDupK := False;
  674.       Keys[5].KeyL := 30;
  675.       Keys[5].AllowDupK := True;
  676.       MakeNetFileBlock(MessageFile, Cfig.MsgDataBasePath+'MSGFILE', 256, 5, Keys);
  677.       if not IsamOK then Log_Fatal_Error('ERROR Creating "MSGFILE"', IsamError)
  678.       else StatusLine('>> Created Message Data Base Files & Indexes <<')
  679.     end;
  680.  
  681.  
  682.   begin
  683.     if ColorScreen then FB_Color := 31
  684.     else FB_Color := 15;
  685.     if ExistFile(Cfig.MsgDataBasePath+'MSGFILE.DAT') then
  686.       begin
  687.         repeat
  688.           if Cfig.DataBaseOpenMode = SaveMode then
  689.           OpenSaveNetFileBlock(MessageFile, Cfig.MsgDataBasePath+'MSGFILE') else
  690.             OpenNetFileBlock(MessageFile, Cfig.MsgDataBasePath+'MSGFILE');
  691.         until LockOk;
  692.         if not IsamOK then Log_Fatal_Error('ERROR OPENING "MSGFILE"', IsamError);
  693.         if Cfig.DataBaseOpenMode = MarkMode then
  694.           ForceWritingMark(True);
  695.       end
  696.     else Create_Messages;
  697.     if initializing then
  698.       begin
  699.         if UsedNetRecs(MessageFile) = 0 then
  700.           begin
  701.             ReadBBSFile(RangeFile, 0, RInfo, True);
  702.             RInfo.MsgLow := 1;
  703.             RInfo.MsgHigh := 0;
  704.             RInfo.ActiveMessages := 0;
  705.             UpdateBBSFile(RInfo);
  706.         end else ReadBBSFile(RangeFile, 0, RInfo, False);
  707.         TotalMessages := RInfo.ActiveMessages;
  708.         if Console_Flag then
  709.           WriteAT(AddCommas(TotalMessages, False), FB_Color, 26, 11);
  710.         CloseBtreeFile(MessageFile);
  711.       end;
  712.   end;
  713.  
  714. end.
  715.  
  716. =============================================================================
  717. CALLINFO
  718. =============================================================================
  719.  
  720. NOTE: We intentionally create a standard text file when we pass control to a
  721.       DOOR.  The idea behind this was to allow 3rd party developers the
  722.       flexibility to read this file using any programming language.  We have
  723.       noticed several authors read this file into a "fixed array".  The
  724.       problem is, when we make changes to this format, it is usually at the
  725.       bottom of the file, in the form of additional lines.  If you are
  726.       going to read this file into an array, make the array big enough so
  727.       it won't crash if we add a few more lines, down the road.  For example,
  728.       create an array[1..80] of String[30], then read until EoF (End of File).
  729.       Since WILDCAT! only uses 36 lines now, chances are your utility will
  730.       work for many years to come before we exceed 80 lines!
  731.  
  732.  
  733.   procedure Save_Caller_Info;
  734.   { Save the callers information when exiting to a live program or
  735.     Dropping to DOS from remote. }
  736.   var
  737.     FileOut        : Text;
  738.     DateTime       : String;
  739.     OldSlash       : Char;
  740.   begin
  741.     Assign(FileOut, HomePath+'CALLINFO.BBS');
  742.     Rewrite(FileOut);
  743.     CheckError('Rewriting CALLINFO.BBS');
  744.     Update_User_Info_Before_LogOff;
  745.     with User do
  746.       begin
  747.         OldSlash := SlashChar;
  748.         SlashChar := '/';
  749.         WriteLn(FileOut, UserName);                                  { Line 1 }
  750.         case Baud of
  751.           B300 : WriteLn(FileOut, '1');                              { Line 2 }
  752.           B1200 : WriteLn(FileOut, '2');
  753.           B2400 : WriteLn(FileOut, '0');
  754.           B9600 : WriteLn(FileOut, '3');
  755.           B19200 : WriteLn(FileOut, '4');
  756.           BLocal : WriteLn(FileOut, '5');
  757.           B38400 : Writeln(FileOut, '6');
  758.           B57400 : Writeln(FileOut, '7');
  759.         end;
  760.         WriteLn(FileOut, CallingFrom);                               { Line 3 }
  761.         WriteLn(FileOut, SecurityLevel);                             { Line 4 }
  762.         WriteLn(FileOut, User.TimeLeft);                             { Line 5 }
  763.         if ColorMenus then WriteLn(FileOut, 'COLOR')
  764.         else                                                         { Line 6 }
  765.           WriteLn(FileOut, 'MONO');
  766.         WriteLn(FileOut, Password);                                  { Line 7 }
  767.         WriteLn(FileOut, UserRefNum);                                { Line 8 }
  768.         WriteLn(FileOut, TimeOn);                                    { Line 9 }
  769.         WriteLn(FileOut, TimeStr);                                  { Line 10 }
  770.         with DateTimeCalled do
  771.           DateTime := TimeToTimeString('hh:mm', T)+' '+DatetoDateString('mm/dd/yy', D);
  772.         WriteLn(FileOut, DateTime);                                 { Line 11 }
  773.         WriteLn(FileOut, ConfJoined);                               { Line 12 }
  774.         WriteLn(FileOut, DailyDL);                                  { Line 13 }
  775.         WriteLn(FileOut, Cfig.SecMaxDL[Array_Level]);               { Line 14 }
  776.         WriteLn(FileOut, Sc(DailyDK));                              { Line 15 }
  777.         WriteLn(FileOut, Sc(Cfig.SecMaxDK[Array_Level]/1024));      { Line 16 }
  778.         WriteLn(FileOut, User.PhoneNumber);                         { Line 17 }
  779.         WriteLn(FileOut, DatetoDateString('mm/dd/yy', TimeDate.D)+Space+
  780.                 TimeToTimeString('hh:mm', TimeDate.T));             { Line 18 }
  781.         if User.Xpert = Novice then WriteLn(FileOut, 'NOVICE')
  782.         else                                                        { Line 19 }
  783.           WriteLn(FileOut, 'EXPERT');
  784.         case User.TransferMethod of                                 { Line 20 }
  785.           All : WriteLn(FileOut, 'All');
  786.           Ymodem : WriteLn(FileOut, 'Ymodem');
  787.           YmodemG : WriteLn(FileOut, 'Ymodem/G');
  788.           Xmodem : WriteLn(FileOut, 'Xmodem');
  789.           XmodemCRC : WriteLn(FileOut, 'Xmodem/CRC');
  790.           Xmodem1K : WriteLn(FileOut, 'Xmodem-1K');
  791.           Xmodem1KG : WriteLn(FileOut, 'Xmodem-1K/G');
  792.           Zmodem : Writeln(FileOut, 'Zmodem');
  793.           ASCii : WriteLn(FileOut, 'Ascii');
  794.         end;
  795.         WriteLn(FileOut, DatetoDateString('mm/dd/yy', LastNew.D));  { Line 21 }
  796.         WriteLn(FileOut, Sc(TimesOn));                              { Line 22 }
  797.         WriteLn(FileOut, Sc(LinesPerPage));                         { Line 23 }
  798.         WriteLn(FileOut, Sc(UsersHighestMsgRead(HighMsg, ConfJoined))); { Line 24 }
  799.         WriteLn(FileOut, Sc(Uploads));                              { Line 25 }
  800.         WriteLn(FileOut, Sc(Downloads));                            { Line 26 }
  801.         if DataBits = SevenBits then WriteLn(FileOut, '7  { Databits } ')
  802.         else WriteLn(FileOut, '8  { Databits }');                   { Line 27 }
  803.         if Local then WriteLn(FileOut, 'LOCAL')
  804.         else WriteLn(FileOut, 'REMOTE');                            { Line 28 }
  805.         WriteLn(FileOut, 'COM'+Sc(Cfig.CommPort));                  { Line 29 }
  806.         WriteLn(FileOut, DatetoDateString('mm/dd/yy', BirthDate));  { Line 30 }
  807.         { Write Comm Port Speed }
  808.         if Cfig.FixedRate then WriteLn(FileOut, Cfig.BaudInit)
  809.         else
  810.           WriteLn(FileOut, BaudRate);                               { Line 31 }
  811.         WriteLn(FileOut, AlreadyConnected);                         { Line 32 }
  812.         if MNP_Connection then WriteLn(FileOut, 'MNP/ARQ Connection')
  813.         else WriteLn(FileOut, 'Normal Connection');                 { Line 33 }
  814.         with GlobalNinfo.TimeOff do
  815.           DateTime := DatetoDateString('mm/dd/yy', D)+' '+TimeToTimeString('hh:mm', T);
  816.         WriteLn(FileOut, DateTime);                                 { Line 34 }
  817.         WriteLn(FileOut, Cfig.NodeID);                              { Line 35 }
  818.         WriteLn(FileOut, DoorNumber);                               { Line 36 }
  819.         SlashChar := OldSlash;
  820.       end;                                                             { With }
  821.     Close(FileOut);
  822.     CheckError('Closing CALLINFO.BBS File');
  823.   end;
  824.  
  825.  
  826. This is what a tipical CALLINFO.BBS file looks like:
  827.  
  828. Jim Harrer
  829. 5
  830. Bakersfield, CA
  831. 1000
  832. 120
  833. MONO
  834. WCATIS#1
  835. 1
  836. 0
  837. 12:44
  838. 12:44 05/08/89                            { Changed in v2.x }
  839. ABCDEFGHIJKLMNOYZ
  840. 0
  841. 100
  842. 0
  843. 10
  844. 555-555-5555
  845. 05/08/89 12:44
  846. NOVICE
  847. All
  848. 04/24/89
  849. 190
  850. 23
  851. 808
  852. 0
  853. 2
  854. 8  { Databits }
  855. LOCAL
  856. COM0
  857. 06/26/58
  858. 38400
  859. FALSE
  860. Normal Connection
  861. 05/08/89 13:44
  862. 1
  863. 0
  864.  
  865. Final Comment: In order to keep track of midnight rollovers, line 11 was
  866. modified in version 2.x to include MM/DD/YY.  This may (or may not) affect
  867. some doors.
  868.  
  869.  
  870.